home *** CD-ROM | disk | FTP | other *** search
- Path: allmalt.cs.uwm.edu!kumbera
- From: kumbera@allmalt.cs.uwm.edu (Mike Kumbera)
- Newsgroups: comp.lang.c++
- Subject: problem initializing static member of a class.
- Date: 3 Feb 1996 04:06:18 GMT
- Organization: Computer Science University of Wisconsin-Milwaukee
- Message-ID: <4eumvq$ko1@uwm.edu>
- NNTP-Posting-Host: 129.89.139.2
-
- I'm having troubles getting a static initilaizer for a member
- of a class working. I want to declare a static array of pointers
- to a class as a member of the class.
- (If this is possible)
-
- The following code is a short example of what I'm trying to do:
-
-
- ------------------------------------------------------------
-
- #include <iostream.h>
-
- class TEST
- {
- // a static array of pointers to the class TEST
- static TEST *TEST_ptr[];
- };
-
- // initialize the static member (I can't get this working)
- TEST *TEST::TEST_ptr[] = NULL;
-
- main()
- {
- TEST a;
- }
-
-
- ------------------------------------------------------------
-
- When I compile the code with gcc I get:
- help.C:10: invalid initializer
-
- ANY ideas would be appreciated...
-
- mkumbera@cs.uwm.edu (Michael Kumbera)
-